<?php
/**
 * Created by PhpStorm.
 * User: Sergey
 * Date: 11.02.14
 * Time: 0:47
 */

error_reporting(E_ALL);
ini_set('display_errors', 1);

define("BASE_DQ_PLUGIN_PATH", plugin_dir_path(__FILE__));
?>

<? include_once BASE_DQ_PLUGIN_PATH . "header.php"; ?>

<div class="wrap">
    <h2>Административная панель "Distant Quiz"</h2>

    <?
    $currentUser = wp_get_current_user();
    $role = $currentUser->roles[0];
    ?>

    <? if ($role == "administrator") { ?>
        <div class="jquery-tabs">
            <ul>
                <li><a href="#tutor">Преподаватели</a></li>
                <li><a href="#groups">Группы</a></li>
                <li><a href="#students">Студенты</a></li>
            </ul>
            <div id="tutor">
                <? include BASE_DQ_PLUGIN_PATH . "data/tutors-content-table.php"; ?>
            </div>
            <div id="groups">
                <? include BASE_DQ_PLUGIN_PATH . "data/groups-content-table.php" ?>
            </div>
            <div id="students">
                <? include BASE_DQ_PLUGIN_PATH . "data/students-content-table.php" ?>
            </div>
        </div>
    <? } elseif ($role == "author") { ?>
        <a href="<?= menu_page_url("distant-quiz/quiz-form.php", false) ?>" class="jquery-button">Добавить новый тест</a>
        <br>
        <br>
        <? include BASE_DQ_PLUGIN_PATH . "data/quizzes-content-table.php" ?>
    <? } ?>
</div>